home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pas_all.zip / TI496.ASC < prev    next >
Text File  |  1992-05-13  |  4KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Turbo Pascal                           NUMBER  :  496
  9.   VERSION  :  6.0
  10.        OS  :  Dos
  11.      DATE  :  May 13, 1992                             PAGE  :  1/4
  12.  
  13.     TITLE  :  Turbo Vision, 132 Column Mode
  14.  
  15.  
  16.  
  17.  
  18.   program TV132;
  19.  
  20.   { this program shows how to put a Turbo Vision application in
  21.     132 column mode.  it is written specifically for an ATI VGA
  22.     card but can be modified for other cards.  also your mouse
  23.     drive must be able to support 132 columns. }
  24.  
  25.   {$X+}
  26.   uses
  27.      objects, drivers, views, app, dialogs , menus, dos;
  28.   const
  29.     cm_DoIt = 100;
  30.  
  31.   type
  32.      PMyApp = ^TMyApp;
  33.      TMyApp = object(TApplication)
  34.        procedure InitMenuBar; virtual;
  35.        procedure InitScreen; virtual;
  36.        procedure HandleEvent(var Event: TEvent); virtual;
  37.        procedure CMDoIt;
  38.      end;
  39.  
  40.      PMyDialog = ^TMyDialog;
  41.      TMyDialog = object(TDialog)
  42.        procedure InitFrame; virtual;
  43.        procedure HandleEvent(var Event: TEvent); virtual;
  44.      end;
  45.  
  46.      PMyFrame = ^TMyFrame;
  47.      TMyFrame = object(TFrame)
  48.        procedure Draw; virtual;
  49.      end;
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Turbo Pascal                           NUMBER  :  496
  75.   VERSION  :  6.0
  76.        OS  :  Dos
  77.      DATE  :  May 13, 1992                             PAGE  :  2/4
  78.  
  79.     TITLE  :  Turbo Vision, 132 Column Mode
  80.  
  81.  
  82.  
  83.  
  84.   procedure TMyFrame.Draw;
  85.   begin
  86.   end;
  87.  
  88.   procedure TMyDialog.InitFrame;
  89.   var
  90.     R: TRect;
  91.   begin
  92.     TDialog.InitFrame;
  93.   (*
  94.     R.Assign(0, 0, Size.X, Size.Y);
  95.     Frame := new(PMyFrame, init(R));
  96.   *)
  97.   end;
  98.  
  99.   procedure TMyApp.CMDoIt;
  100.   var
  101.     D: PMyDialog;
  102.     ILine : PInputLine;
  103.     R: TRect;
  104.   begin
  105.     R.Assign(5, 5, 25, 12);
  106.     new(D, init(R, 'Do It'));
  107.     D^.SetState(sfShadow, false);
  108.     R.Assign(1, 1, 19, 2);
  109.     new(ILine, init(R, 20));
  110.     R.Assign(1, 3, 19, 4);
  111.     D^.Insert(Iline);
  112.     D^.Insert(new(PInputline, init(R, 20)));
  113.     R.Assign(1, 5, 11, 7);
  114.     D^.Insert(new(PButton, Init(R, '~O~k', cmOk, bfDefault)));
  115.     Iline^.Select;
  116.     Desktop^.ExecView(D);
  117.   end;
  118.  
  119.   procedure TMyDialog.HandleEvent(var Event: TEvent);
  120.   begin
  121.     if Event.What = evKeyDown then
  122.       if Event.KeyCode = kbEnter then
  123.         Event.KeyCode := kbTab;
  124.     TDialog.HandleEvent(Event);
  125.   end;
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Turbo Pascal                           NUMBER  :  496
  141.   VERSION  :  6.0
  142.        OS  :  Dos
  143.      DATE  :  May 13, 1992                             PAGE  :  3/4
  144.  
  145.     TITLE  :  Turbo Vision, 132 Column Mode
  146.  
  147.  
  148.  
  149.  
  150.   procedure TMyApp.InitMenuBar;
  151.   var R:TRect;
  152.   begin
  153.     GetExtent(R);
  154.     R.B.Y := R.A.Y + 1;
  155.     MenuBar := New(PMenuBar, Init(R, NewMenu(
  156.       NewItem('~D~o it', '', kbNoKey, cm_DoIt, hcNoContext,
  157.       nil)
  158.     )));
  159.   end;
  160.  
  161.   procedure TMyApp.HandleEvent(var Event: TEvent);
  162.   begin
  163.     TApplication.HandleEvent(Event);
  164.     if Event.What = evCommand then
  165.       if Event.Command = cm_DoIt then
  166.       begin
  167.         CMDoIt;
  168.       end;
  169.   end;
  170.  
  171.   procedure TMyApp.InitScreen;
  172.   { this procedure is specific to an ATI VGA Card, you may need to
  173.     modify if you have a different video card. }
  174.   begin
  175.     TApplication.InitScreen;
  176.     asm
  177.       mov ah, 0
  178.       mov al, 23H
  179.       int 10H
  180.     end;
  181.     ScreenMode := $23;
  182.     ScreenHeight := 25;
  183.     ScreenWidth := 132;
  184.   end;
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.   PRODUCT  :  Turbo Pascal                           NUMBER  :  496
  207.   VERSION  :  6.0
  208.        OS  :  Dos
  209.      DATE  :  May 13, 1992                             PAGE  :  4/4
  210.  
  211.     TITLE  :  Turbo Vision, 132 Column Mode
  212.  
  213.  
  214.  
  215.  
  216.   var
  217.     MyApp: TMyApp;
  218.  
  219.   begin
  220.     MyApp.Init;
  221.     MyApp.Run;
  222.     MyApp.Done;
  223.   end.
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.